home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / JForth / Extras / SysGen / DOSCOMMANDS < prev    next >
Encoding:
Text File  |  1989-01-19  |  1.7 KB  |  43 lines

  1. \ Monday 13-Oct-86 05:28:13 ...  Mike Haas
  2.  
  3. \ 02-jan-87  mdh  use LWORD to pass rest of input line in same case.
  4. \ MOD: PLB MOD: 8/19/88 Add $DOS
  5. \ MOD: PLB 1/12/89 Removed LIST because of conflict with Amiga Exec.
  6.  
  7. : DOSCommand ( <name> -- )  \ usage:  DOSCOMMAND DIR
  8.     \    when executed, will take rest of the input string for DOS
  9.   CREATE \ ... thass all I need here, thank you
  10.   DOES>  >newline   do-does-size -  >name   \ NFA -- )
  11.          dup 1+ swap   c@  $ 1f and   \ TEXT CNT -- ) must strip header stuff
  12.          >dos       "  " count +dos   \ -- )   put command and a blank there
  13.          eol lword  count +dos        \ -- )   put in rest of input line
  14.          dos0 >abs ( string-adr -- ) 0 ( infile ) CONSOLEOUT @ ( outfile )
  15.          call dos_lib execute  drop     ( consider it done! )
  16. ;
  17.  
  18.  
  19. \ NOTE: cd is predefined in JForth...do not redefine!
  20. \ also, keep the forth names in mind!  (like DO and EXECUTE ... both taken!)
  21.  
  22. \    And REMEMBER...AmigaDOS does not support input through the Execute()
  23. \ call, so it is probably a good idea not to define commands which could
  24. \ go on forever, or require keyboard input (like DiskCopy).
  25.  
  26. \    Instead, use NewCLI to create a regular AmigaDOS window for
  27. \ fancy stuff!  (This is a quick and dirty convienience...NOT an all-out
  28. \ interface to the CLI environment!)
  29.  
  30. \ DO NOT define TYPE, DO, EXECUTE or LIST.  They conflict with Forth!!
  31. doscommand dir        doscommand status
  32. doscommand run        doscommand delete
  33. doscommand copy       doscommand rename
  34. doscommand newcli     doscommand date
  35. doscommand avail      doscommand info
  36. doscommand assign     doscommand path
  37.  
  38. : $DOS ( $string -- , execute as dos command )
  39.     count >dos
  40.     dos0 >abs 0 consoleout @
  41.     call dos_lib execute drop
  42. ;
  43.